<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 选中body
        var body = document.body;
        // 创建标签名为div的元素(必有)
        var box = document.createElement('div');
        // 设置元素的class为box
        box.setAttribute('class', 'box');
        // 设置元素的内容
        box.innerText = 'hello world';
        // 给box一个爸爸(必有)
        body.appendChild(box);

    </script>
</body>

</html>